From: Florian Müllner Date: Mon, 14 Aug 2023 22:13:34 +0000 (+0200) Subject: quickSettings: Add insertItemBefore() method X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~320^2^2~90 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=30a36c970b52f03c92b3977abd087bb6eec53df9;p=gnome-shell.git quickSettings: Add insertItemBefore() method The QuickSettings menu currently only support appending items at the end. Extensions can get around that limitation by accessing the private grid property to move the item afterwards, but we don't allow this in our own code. Expose a new insertItemBefore() method that allows adding an item before an existing one. Part-of: --- diff --git a/js/ui/quickSettings.js b/js/ui/quickSettings.js index 83597c6d4..c684141f7 100644 --- a/js/ui/quickSettings.js +++ b/js/ui/quickSettings.js @@ -780,6 +780,15 @@ export const QuickSettingsMenu = class extends PopupMenu.PopupMenu { addItem(item, colSpan = 1) { this._grid.add_child(item); + this._completeAddItem(item, colSpan); + } + + insertItemBefore(item, sibling, colSpan = 1) { + this._grid.insert_child_below(item, sibling); + this._completeAddItem(item, colSpan); + } + + _completeAddItem(item, colSpan) { this._grid.layout_manager.child_set_property( this._grid, item, 'column-span', colSpan);